import request from '@/utils/request.ts'
import {Article} from "@/api/article/type.ts";

/**
 * 保存文章
 */
export const submitArticleReq = (data: Article) => request.post('/article/submit', data)

/**
 * 查询文章列表
 */
export const getArticleListReq = () => request.get('/article/list', {})

/**
 * 删除文章
 */
export const deleteArticleReq = (id: number) => request.delete(`/article/${id}`, {})

/**
 * 根据文章id查询文章
 */
export const getArticleByIdReq = (id: number) => request.get(`/article/${id}`, {})

/**
 * 保存文章图片，上传url
 */
export const saveArticleImageUrlReq = (url: string, imgName?: string) => request.post('/article/saveUrl', {}, {
    params: {
        url, imgName
    }
})
